import os
import sys

# 使用绝对路径
RAW_DIR = r"D:\\tennis\\代码与模型数据\\data\\raw"
VIDEO_EXTS = [".mp4", ".avi", ".mov", ".mkv", ".webm"]

def find_video_files(folder: str):
    if not os.path.exists(folder):
        print(f"[ERROR] Folder not found: {folder}")
        return []

    files = []
    for fname in os.listdir(folder):
        full_path = os.path.join(folder, fname)
        if os.path.isfile(full_path):
            ext = os.path.splitext(fname)[-1].lower()
            if ext in VIDEO_EXTS:
                files.append(full_path)
    return files

def main():
    print(f"[INFO] Checking video files in: {RAW_DIR}")
    files = find_video_files(RAW_DIR)
    if files:
        print("[OK] Video files found:")
        for f in files:
            print(f"   - {os.path.basename(f)}")
    else:
        print(f"[ERROR] No video found in {RAW_DIR}")
        sys.exit(1)

if __name__ == "__main__":
    main()